package com.eclipse.e20200131_模拟连接池.demo;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

public class Test {
	static List<String> pool = new ArrayList<>();
	public static void main(String[] args) throws InterruptedException {
//		long 当前毫秒数 = System.currentTimeMillis(); 
//		System.out.println(当前毫秒数);
//		long 当前纳秒数 = System.nanoTime();
//		System.out.println(当前纳秒数);
		
		TimeUnit.SECONDS.sleep(5);
		
		String 接收=null;
		pool.add("789");
		System.out.println(接收);
		接收 = jdbc();
		System.out.println(接收);
		//数组下标越界
		System.out.println(pool.get(0));
	}
	
	static String jdbc() {
		//返回并且删除
		if (pool.size() > 0) {
			return pool.remove(pool.size() - 1);
		}
		return "空";
	}
}
